<?php $this->load->view('header/admin'); ?>
<div id="main">
    <div class="container">
        <div class="span-17 colborder" id="content">
        <?php if (isset($messages)) echo $messages; ?>
            <h3 class="caps">Clubs</h3>
	        <?php if ($clubs): ?>
	           <div class="span-16 last">
                    <div class="box span-16">
                        <p>Click on the name of the club for more information</p>
                        <dl class="enumeration">
                        <?php foreach($clubs as $c): ?>
                            <dt class="prepend-top">
                                <?php echo anchor('admin/clubs/see/'.$c->id, $c->name, 'class="club-info" id="club-'.$c->id.'"')?>&nbsp;
                            </dt>
                            <dd>Members: <?php echo count($c->Pilots)?></dd>
                        <?php endforeach; ?>
                        </dl>
                    </div>
                </div>
			<?php endif; ?>
			<div class="span-16 last">
	        <p><?php if ($isOwner) echo anchor('admin/clubs/add', 'Add Club')?></p>
	        </div>
        </div> <!-- end content -->
        <?php $this->load->view('menu/admin')?>
    </div> <!-- end container -->
    <script type="text/javascript">
    $(document).ready(function() {
    	$('.box').corner("");
        
        /*if (location.hash != '') {
            $.getJSON('/admin/clubs/ajax/view/'+location.hash.substring(1), function(data) {
                $.each(data, function(key, value) {
                    $('#club-' + key).html(value);
                });

                $('#club-active').html((data.active)? 'Yes':'No');
                $('#club-'+id[1]).addClass('selected');
            });
        }
                
        $('.club-info').click(function(event) {
            event.preventDefault();
            var id = event.target.id.match(/^club-([0-9]+)$/);

            $.getJSON('/admin/clubs/ajax/view/'+id[1], function(data) {
                $.each(data, function(key, value) {
                    $('#club-' + key).html(value);
                });

                $('#club-active').html((data.active)? 'Yes':'No');

                $('.club-info.selected').removeClass('selected');
                $('#club-'+id[1]).addClass('selected');
                
                location.hash = id[1];
            });
        });*/
    });
    </script>
</div> <!-- end main -->
<?php $this->load->view('footer/standard');?>
